package entity

import (
	"bp/conf"
	"bp/db"
	cardDiscountService "bp/internal/service/entity/card_discount"
	couponService "bp/internal/service/entity/coupon"
	memberCouponService "bp/internal/service/entity/member_coupon"
	nsqService "bp/internal/service/entity/nsq"
	offApportionmentService "bp/internal/service/entity/off_apportionment"
	offTransactionService "bp/internal/service/entity/off_transaction"
	offTrialService "bp/internal/service/entity/off_trial"
	promotionService "bp/internal/service/entity/promotion"
	"go.uber.org/zap"
)

type EntityHub struct {
	slog                    *zap.SugaredLogger
	CardDiscountService     *cardDiscountService.CardDiscountEntityServiceImp
	CouponService           *couponService.CouponEntityServiceImp
	MemberCouponService     *memberCouponService.MemberCouponEntityServiceImp
	NsqService              *nsqService.NsqEntityServiceImp
	OffApportionmentService *offApportionmentService.OffApportionmentEntityServiceImp
	OffTransactionService   *offTransactionService.OffTransactionEntityServiceImp
	OffTrialService         *offTrialService.OffTrialEntityServiceImp
	PromotionService        *promotionService.PromotionEntityServiceImp
}

// NewEntityHub initialization
func NewEntityHub(
	slog *zap.SugaredLogger,
	pgdao *db.PgDao,
	vars *conf.VarsSection,
	// proxy *client.GrpcClientProxy,
	// adp *cache.Adapter,
) (hub *EntityHub) {
	hub = &EntityHub{
		slog:                    slog.With("module", "ServiceHub"),
		CardDiscountService:     cardDiscountService.NewCardDiscountEntityService(pgdao, slog, vars),
		CouponService:           couponService.NewCouponEntityService(pgdao, slog, vars),
		MemberCouponService:     memberCouponService.New(pgdao, slog, vars),
		NsqService:              nsqService.New(pgdao, slog, vars),
		OffApportionmentService: offApportionmentService.New(pgdao, slog, vars),
		OffTransactionService:   offTransactionService.New(pgdao, slog, vars),
		OffTrialService:         offTrialService.New(pgdao, slog, vars),
		PromotionService:        promotionService.NewPromotionEntityService(pgdao, slog, vars),
		// cacher:           adp,
		// activityService: activityService,
	}

	return
}
